#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "logger.h"
#include "bmpfile.h"
#include "aboutdialog.h"
#include "knn.h"
#include "database.h"
#include "commonmarco.h"

#include <iostream>
#include <string>

#include <QMainWindow>
#include <QDebug>
#include <QFile>
#include <QMutex>
#include <QMutexLocker>
#include <QString>
#include <QCoreApplication>
#include <QDir>
#include <QException>
#include <QDateTime>
#include <QSharedPointer>

typedef QSharedPointer<BMPFile> bmpFile_type;

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    void initMenu();
    void initComBox();
    void directSaveChara();

public slots:
    void slotAbout();

private:
    inline bool doGetFileName(QString &fileName);
    bool dbTest();
    void findMaxNum(CharacterVector* pCharactor,int maxSize);
    inline void stepShow();
    inline void doStepShowAfterExec();
    inline void resetPreButton();
    inline bool stepPreCheck(const int& stepIndex);
    inline void showAfterRecognise(const bmpFile_type& pBMPFile);

private slots:
    void on_btnLeftOpenPicture_clicked();

//    void on_btnRightOpenPicture_clicked();

    void on_btnQuit_clicked();    

    void on_btnStepInner_clicked();

    void on_btnStepOuter_clicked();

    void on_btnStepUnitize_clicked();

    void on_btnStepLOGBin_clicked();

    void on_btnStepMorph_clicked();

    void on_btnStepGetChararctor_clicked();

    void on_btnStepSaveChara_clicked();

    void on_btnStepRecognise_clicked();

    void on_btnGetChara_clicked();

    void on_btnRecognise_clicked();

private:
    Ui::MainWindow *ui;
    Logger*     m_pLogger;
    database_type m_pDB;
    bmpFile_type m_pBMPFile;
    bmpFile_type m_pBMPFileAll;

    QString m_rootPath;

    bool    m_iIsGetChara;
    bool    m_iIsComparing;
    bool    m_iIsLeftSelected;
//    bool    m_iIsRightSelected;
    QString m_leftPictureName;
//    QString m_rightPictureName;

    int     m_allSteps;
//    int     m_curStep;
    int     m_curStepAll;
};

#endif // MAINWINDOW_H
